<?

require_once ("application.fieldset.inc");

global $_GLOBAL_DBH;
global $_OBJECT_IFACE_PANEL;

$fieldset_users = new Fieldset (array (
	db_conn=>$_GLOBAL_DBH,
	relation=>"project_task_users",
	prefix=>"ptu_",
	fieldset=>array (
		array (name=>"id",label=>"ID",type=>"numeric",
				value=>$_REQUEST["user_id"],
				input=>"hidden",primary_key=>true),
		array (name=>"task_id",label=>"Task ID",type=>"numeric",
				value=>$_REQUEST["task_id"],
				input=>"hidden"),
		array (name=>"user_id",label=>"User ID",type=>"numeric",
				value=>$_APP_SESSION_USER->id,
				input=>"hidden"),
		array (name=>"title",label=>"Title",type=>"alphanumeric",
				input=>"field"),
		array (name=>"details",label=>"Details",type=>"alphanumeric",
				input=>"textarea",rows=>5),
		array (name=>"cdate",label=>"Create Date",type=>"any",
				input=>"date_time"),
	)
));

$fieldset_users->parse ();

$return = "/fs_projects.php?fs_tab_tasks=users&project_id={$_REQUEST["project_id"]}&fs_tab=tasks&fs_tab_option=fs_tasks&fs_action=view&task_id={$_REQUEST["task_id"]}";

$fs_options = array (
	addnew=>array (label=>"Add New"),
	create=>array (label=>"Create"),
	modify=>array (label=>"Modify"),
	remove=>array (label=>"Remove"),
	update=>array (label=>"Update"),
	cancel=>array (label=>"Cancel"),
	delete=>array (label=>"Delete",
			redirect=>dirname ($_SERVER["PHP_SELF"]) . $return),
	canret=>array (label=>"Cancel",
			redirect=>dirname ($_SERVER["PHP_SELF"]) . $return),
	close=>array (label=>"Close",
			redirect=>dirname ($_SERVER["PHP_SELF"]) . $return),
);

$image_options = array (size=>$_REQUEST["_img_size"]);

list ($fs_input, $fs_action, $store, $valid, $success) =

	_app_process_fieldset (array (
		fieldset=>$fieldset_users,
		fs_options=>$fs_options,
		fs_primary_key=>"user_id",
		fs_action=>($_REQUEST["fs_action_users"] ?
				$_REQUEST["fs_action_users"] :
				"view"),
		fs_action_field=>"fs_action_users",
		fs_prefix=>"ptu_",
));

$_OBJECT_FIELDSET_CONTROL =_app_create_fieldset_object (array (
	fieldset_id=>"fs_project_task_users",
	db_conn=>$_GLOBAL_DBH,
	fieldset=>$fieldset_users,
	fs_action=>$fs_action,
	fs_input=>$fs_input,
	fs_link=>"fs_projects.php?fs_tab=tasks&project_id={$_REQUEST["project_id"]}&fs_tab_option=fs_tasks&fs_action=view&fs_tab_tasks=users&fs_tab_option_tasks=fs_users&task_id={$_REQUEST["task_id"]}",
	fs_options=>$fs_options,
	fs_action_field=>"fs_action_users",
	fs_prefix=>"ptu_",
));

$_OBJECT_IFACE_TABBING_PANEL->insert_container ($_OBJECT_FIELDSET_CONTROL);

?>
